const Koa = require('koa');
const Router = require('koa-router');

const app  = new Koa();
const router = new Router({
    prefix: '/xgp'   //加前缀
});

router
    .get('/',(ctx,next) => {
        ctx.body = "Hello xgp";
    })
    .get('/todo',(ctx,next) => {
        ctx.body = "Todo Page";
    });

app
    .use(router.routes())
    .use(router.allowedMethods());

// 监听端口
app.listen(3000,() => {
    //监听回调
    console.log('app is start at port 3000');
});
